package com.ht.yml.tools;

import java.util.Map;

/**
 * @author wangmin
 * @discription
 * @created 2024-12-30 10:50
 */
public class TesterForValidateForSpringCloudConfig {
    public static void main(String[] args) throws Exception {
        final String env = "pro";

        final Map<String, Object> apolloAllConfigMap = ApolloConfigUtils.loadApolloConfigs(Const.destAppId, "app_const.yaml,"+env+".yaml");
        System.out.println("apolloAllConfigs:");
        String apolloAll_yamlStr = YamlReader.dump(apolloAllConfigMap);
        System.out.println(apolloAll_yamlStr);
        System.out.println("\n\n\n");

        final String configPathPrefix;
        if ("pro".equals(env)) {
            configPathPrefix = "D:\\恒太svn代码\\cloudconfig\\config\\";
        } else {
            configPathPrefix = "D:\\恒太svn代码\\springcloud\\config\\";
        }
        Map<String, String> envConfigSource = ApplicationConfigUtils.readPropertyFile(configPathPrefix + "data-center-"+env+".properties");
        Map<String, Object> envConfigYaml = YamlPropertiesUtils.convertProperties2YmlMap(envConfigSource);
        System.out.println("envConfigYaml:");
        String envConfigYaml_yamlStr = YamlReader.dump(envConfigYaml);
        System.out.println(envConfigYaml_yamlStr);
        System.out.println("\n\n\n");

        YamlPropertiesUtils.compare(apolloAllConfigMap, "apollo", envConfigYaml, env+"配置文件");
    }


}
